#!/bin/sh

if [ $# -eq 1 ]; then
    SRC=$1
    DST=`pwd`

    cd $SRC
    for i in `find . -print | sed 's:^\.$::' | sed 's: :!@!:g'`; do
	FILE=`echo $i | sed 's:!@!: :g'`;
	if [ -d $SRC/"$FILE" ]; then
	    if [ ! -d $DST/"$FILE" ]; then
			if [ -h $SRC/"$FILE" ]; then
	    		cp -dv $SRC/"$FILE" $DST/"$FILE"
			else
				echo "mkdir -p $DST/$FILE"
				mkdir -p $DST/"$FILE"
			fi
	    fi
	else
	    [ ! -f $DST/"$FILE" ] && cp -dv $SRC/"$FILE" $DST/"$FILE"
	fi
    done

    cd $DST
    unset SRC DST
	echo "*****************************************"
	echo "Copy frome $0 to $(pwd) complete"
	echo "*****************************************"
else
    echo "Usage: $0 source-pathname"
    echo "For example:"
    echo "    $0 /media/sourceDisk/source/Tractor"
fi
